home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Snippets / CustomDialog Demo / Source / ErrUtils.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-31  |  2.3 KB  |  79 lines  |  [TEXT/MMCC]

  1. /**********************************************************************
  2.  *
  3.  *                        CustomGetFile Dialog Demo
  4.  *
  5.  *    ErrUtils.c
  6.  *
  7.  *    This unit handles all my errors in a nice easy fashion.  
  8.  *    The code comes from "Macintosh Programing Secrets, 3rd Ed"
  9.  *        by Scott Knaster and Keith Rollin.
  10.  *
  11.  *    Written in CodeWarrior Gold 5.5
  12.  *    August 31, 1995
  13.  *
  14.  *    Copyright © 1995 Carl B. Constantine
  15.  *    Some portions Copyright © 1995 MetroWerks, Inc.
  16.  *    Some portions Copyright © 1995 Apple Computer, Inc.
  17.  *
  18.  **********************************************************************/
  19.  
  20.  /*------------------------------------------------------------------
  21.   #
  22.   #                            File History
  23.   #
  24.   #        Date                Description of Change
  25.   #        ----                ---------------------
  26.   #        Aug 31/93            — Original creation of file
  27.   #
  28.   #
  29.   -------------------------------------------------------------------*/
  30.  
  31.  
  32. /*=========================== Include Files ==============================*/
  33.  
  34. #include "AppGlobals.h"
  35. #include "AppConstants.h"
  36. #include "ErrUtils.h"
  37.  
  38. /*======================== Procedures and functions ==========================*/
  39.  
  40.  
  41. /*    Display an alert that tells the user an error occurred, then exit the
  42.     program. This routine is used as an ultimate bail-out for serious errors
  43.     that prohibit the continuation of the application. The error number is
  44.     used to index an 'STR#' resource so that a relevant message can be
  45.     displayed.    */
  46.     
  47. void DeathAlert( short errNumber )
  48. {
  49.     short    itemHit;
  50.     Str255    theMessage;
  51.     
  52.     SetCursor( &qd.arrow );
  53.     GetIndString( theMessage, rErrorStrings, errNumber );
  54.     ParamText( theMessage, nil, nil, nil );
  55.     itemHit = Alert( rErrorAlert, nil );
  56.     ExitToShell();
  57.     
  58. }
  59.  
  60. /*----------------------------------------------------------------------------*/
  61.         
  62. /*    Display an alert that tells the user an error occurred. This routine is 
  63.     used as warning for general errors that prohibit the continuation of the 
  64.     application. The error number is used to index an 'STR#' resource so that 
  65.     a relevant message can be displayed.    */
  66.     
  67. void GenAlert( short errNumber )
  68. {
  69.     short    itemHit;
  70.     Str255    theMessage;
  71.     
  72.     SetCursor( &qd.arrow );
  73.     GetIndString( theMessage, rErrorStrings, errNumber );
  74.     ParamText( theMessage, nil, nil, nil );
  75.     itemHit = Alert( rErrorAlert, nil );
  76.     
  77. }
  78.  
  79. /*============================ End of File ===================================*/